<template>
  <div class="home">
    <ly-tab
      v-model="selectedId"
      :options="options"
      :items="items"
      @change="handleChange"
      class="fix"
    />
    <router-view></router-view>

  </div>
</template>

<script>
export default {
  mame: 'Home',
  data () {
    return {
      // 选中的id
      selectedId: 0,
      items: [
        {label: '热门'},
        {label: '服饰'},
        {label: '鞋包'},
        {label: '母婴'},
        {label: '百货'},
        {label: '食品'},
        {label: '内衣'},
        {label: '男装'},
        {label: '电器'}
      ],
      options: {
        activeColor: '#e9232c' // 设置选中的颜色
      },
      subRouterUrl: [
        '/home/hot',
        '/home/dress',
        '/home/box',
        '/home/mbaby',
        '/home/general',
        '/home/food',
        '/home/shirt',
        '/home/man',
        '/home/ele',
      ]
    }
  },
   methods: {
        handleChange(item, index) {
          //console.log(item,index)
          //console.log(this.$router)
          this.$router.replace(this.subRouterUrl[index])

        }
      }
}
</script>

<style lang="stylus" scoped>
.home
  width 100%
  height 100%
  
  .fix
    position fixed
    background #fff
    z-index 99
    left 0
    right 0
    top 0
</style>
